package com.chis.ms;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Telec {

    public static void main(String[] args) {
        File file = new File("C:\\Users\\wlj\\Desktop\\0407\\kccode.txt");
        FileReader m = null;
        try {
            m = new FileReader(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        BufferedReader reader = new BufferedReader(m);
        List<String> al = new ArrayList<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if(nextline != null){
                    al.add(nextline);
//                    System.out.println(nextline);
//                    if(!l.contains(nextline)){
//                        l.add(nextline);
//                    }
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }

        file = new File("C:\\Users\\wlj\\Desktop\\0407\\upall.txt");
        try {
            m = new FileReader(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        reader = new BufferedReader(m);
        List<String> ul = new ArrayList<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if(nextline != null){
                    ul.add(nextline);
//                    System.out.println(nextline);
//                    if(!l.contains(nextline)){
//                        l.add(nextline);
//                    }
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }

        file = new File("C:\\Users\\wlj\\Desktop\\0407\\SEND_CODES.txt");
        try {
            m = new FileReader(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        reader = new BufferedReader(m);
        List<String> HBASE = new ArrayList<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if(nextline != null){
                    HBASE.add(nextline);
//                    System.out.println(nextline);
//                    if(!l.contains(nextline)){
//                        l.add(nextline);
//                    }
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }

        file = new File("C:\\Users\\wlj\\Desktop\\0407\\41bat.txt");
        try {
            m = new FileReader(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        reader = new BufferedReader(m);
        List<String> sbat = new ArrayList<>();
        while (true) {
            String nextline = null;
            try {
                nextline = reader.readLine();
                if(nextline != null){
                    sbat.add(nextline);
//                    System.out.println(nextline);
//                    if(!l.contains(nextline)){
//                        l.add(nextline);
//                    }
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            if (nextline == null) break;
        }
//
        System.out.println("库存批次"+al.size());
        System.out.println("上传批次"+ul.size());
        System.out.println("已存在批次"+HBASE.size());
        System.out.println("4-1批次"+sbat.size());


//        for(String s : al){
//            String[] bats = s.split("#");
//            String bat = bats[1]+"#"+bats[2];
//
//
//            for(String s1 : ul){
//                String[] bat1s = s1.split("#");
//                String bat1 = bat1s[2]+"#"+bat1s[3];
//                if(bat.equals(bat1) && !HBASE.contains(bat1s[1])){
//                    System.out.println(bat1s[2]+"#"+bat1s[3]+"#"+bats[3]+"#"+bat1s[1]);
//                    break;
//                }
//
//            }
//
//        }

        for(String s : sbat){
            String[] bats = s.split("#");
            String bat = bats[1]+"#"+bats[2];


            for(String s1 : ul){
                String[] bat1s = s1.split("#");
                String bat1 = bat1s[2]+"#"+bat1s[3];
                if(bat.equals(bat1) && !HBASE.contains(bat1s[1])){
                    System.out.println(bat1s[2]+"#"+bat1s[3]+"#"+bat1s[1]);
                    break;
                }

            }

        }

    }
}
